load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@kubevirt//tools/ginkgo:ginkgo.bzl", "ginkgo_test")

go_library(
    name = "go_default_library",
    srcs = [
        "ca-manager.go",
        "tls.go",
        "webhooks.go",
    ],
    importpath = "kubevirt.io/kubevirt/pkg/util/webhooks",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/util:go_default_library",
        "//pkg/virt-api/webhooks:go_default_library",
        "//pkg/virt-operator/resource/generate/components:go_default_library",
        "//staging/src/kubevirt.io/api/core/v1:go_default_library",
        "//staging/src/kubevirt.io/client-go/log:go_default_library",
        "//vendor/k8s.io/api/admission/v1:go_default_library",
        "//vendor/k8s.io/api/core/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
        "//vendor/k8s.io/client-go/tools/cache:go_default_library",
        "//vendor/k8s.io/client-go/util/cert:go_default_library",
        "//vendor/k8s.io/client-go/util/certificate:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "ca-manager_test.go",
        "tls_test.go",
        "webhooks_suite_test.go",
    ],
    embed = [":go_default_library"],
    tags = ["cov"],
    deps = [
        "//pkg/certificates/triple:go_default_library",
        "//pkg/certificates/triple/cert:go_default_library",
        "//pkg/util:go_default_library",
        "//pkg/virt-operator/resource/generate/components:go_default_library",
        "//staging/src/kubevirt.io/client-go/testutils:go_default_library",
        "//vendor/github.com/onsi/ginkgo/v2:go_default_library",
        "//vendor/github.com/onsi/gomega:go_default_library",
        "//vendor/k8s.io/api/core/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
        "//vendor/k8s.io/client-go/tools/cache:go_default_library",
        "//vendor/k8s.io/client-go/util/certificate:go_default_library",
    ],
)

ginkgo_test(
    name = "go_parallel_test",
    ginkgo_args = ["-p"],
    go_test = ":go_default_test",
    tags = ["nocov"],
)
